//
//  FirstViewCell.m
//  UI - 豆瓣
//
//  Created by dllo on 15/10/27.
//  Copyright (c) 2015年 蓝鸥科技. All rights reserved.
//

#import "FirstViewCell.h"
#import "AppTools.h"

@interface FirstViewCell ()


@end

@implementation FirstViewCell
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{

    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createSubView];
    }
    return self;
}

-(void)createSubView{

    UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(5, 20, 365, 165)];
    imageView.image = [UIImage imageNamed:@"bg_eventlistcell.png"];
    [self.contentView addSubview:imageView];
    
    UIImageView *imageView1 = [[UIImageView alloc] initWithFrame:CGRectMake(7.5, 50, 360, 130)];
    imageView1.image = [UIImage imageNamed:@"bg_share_large.png"];
    [self.contentView addSubview:imageView1];
    
    
    UIImageView *imageView2 = [[UIImageView alloc] initWithFrame:CGRectMake(15, 55, 20, 20)];
    imageView2.image = [UIImage imageNamed:@"icon_date.png"];
    [self.contentView addSubview:imageView2];
    UIImageView *imageView3 = [[UIImageView alloc] initWithFrame:CGRectMake(15, 80, 20, 20)];
    imageView3.image = [UIImage imageNamed:@"icon_spot.png"];
    [self.contentView addSubview:imageView3];
    UIImageView *imageView4 = [[UIImageView alloc] initWithFrame:CGRectMake(15, 110, 20, 20)];
    imageView4.image = [UIImage imageNamed:@"icon_catalog.png"];
    [self.contentView addSubview:imageView4];
    
    
    self.lable1 = [[UILabel alloc] initWithFrame:CGRectMake(15, 20, 300, 30)];
    
    [self.contentView addSubview:self.lable1];
    self.lable2 = [[UILabel alloc] initWithFrame:CGRectMake(35, 55, 100, 20)];
    self.lable2.font = [UIFont systemFontOfSize:15];
    [self.contentView addSubview:self.lable2];
    self.lable3 = [[UILabel alloc] initWithFrame:CGRectMake(150, 55, 100, 20)];
    self.lable3.font = [UIFont systemFontOfSize:15];
    [self.contentView addSubview:self.lable3];
    self.lable4 = [[UILabel alloc] initWithFrame:CGRectMake(130, 55, 40, 20)];

    self.lable4.text = @"--";
    [self.contentView addSubview:self.lable4];
    self.lable5 = [[UILabel alloc] initWithFrame:CGRectMake(35, 80, 200, 20)];
    self.lable5.font = [UIFont systemFontOfSize:15];
    [self.contentView addSubview:self.lable5];
    self.lable6 = [[UILabel alloc] initWithFrame:CGRectMake(80, 110, 200, 20)];
    [self.contentView addSubview:self.lable6];
    self.lable6.font = [UIFont systemFontOfSize:15];
    self.lable7 = [[UILabel alloc] initWithFrame:CGRectMake(35, 110, 80, 20)];
    
    self.lable7.text = @"类型：";
    self.lable7.font = [UIFont systemFontOfSize:15]
    ;
    [self.contentView addSubview:self.lable7];
    self.lable7 = [[UILabel alloc] initWithFrame:CGRectMake(25, 150, 80, 20)];

    self.lable7.text = @"感兴趣：";
    self.lable7.font = [UIFont systemFontOfSize:13]
    ;
    [self.contentView addSubview:self.lable7];
    
    self.lable7 = [[UILabel alloc] initWithFrame:CGRectMake(145, 150, 80, 20)];
    
    self.lable7.text = @"参加：";
    self.lable7.font = [UIFont systemFontOfSize:13]
    ;
    [self.contentView addSubview:self.lable7];
    
    self.lable8 = [[UILabel alloc] initWithFrame:CGRectMake(80, 150, 40, 20)];
    [self.contentView addSubview:self.lable8];
    
    
    self.lable9 = [[UILabel alloc] initWithFrame:CGRectMake(185, 150, 40, 20)];
    [self.contentView addSubview:self.lable9];
    
    self.imagview = [[UIImageView alloc] initWithFrame:CGRectMake(270, 55, 90, 115)];
    self.imagview.backgroundColor = [UIColor yellowColor];
    [self.contentView addSubview:self.imagview];
    
    
    
    
}

-(void)setActivety:(Activety *)activety{

    if (_activety != activety) {
        
        [_activety release];
        _activety = [activety retain];
    }
    
    self.lable1.text = _activety.title;
    self.lable2.text = [_activety.begin_time substringWithRange:NSMakeRange(5, 11)];
    self.lable3.text = [_activety.end_time substringWithRange:NSMakeRange(5, 11)];
    self.lable5.text = _activety.address;
    self.lable6.text = _activety.category_name;
    self.lable8.text =[NSString stringWithFormat:@"%@", _activety.participant_count ];
    self.lable9.text = [NSString stringWithFormat:@"%@", _activety.wisher_count];
    [AppTools getWithName:_activety.image block:^(NSData *data1) {
            dispatch_async(dispatch_get_main_queue(), ^{
                self.imagview.image = [UIImage imageWithData:data1];
                
            });
        
    }];
    
}


- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {

    
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
